<?php
class BasicController extends Controller
{
    /**
     * 
     * @param string $engine_name 引擎名称
     * @param string $database_name 数据库名称
     */
    static function change_table_engine($engine_name, $database_name)
    {
        $model = new Model();
        $list = $model->query("show tables;");
         
        for($i=0,$c=count($list); $i<$c; $i++)
        {
            $table_name = $list[$i]['Tables_in_'.$database_name];
            $model->query("alter table $table_name engine=$engine_name;");
        }
    }
    
	public function index()
	{

	    /*
	    $obj = Common::get_user_obj_by_name('13832988501');
	    print_r($obj);die;
	    */
	    
	    //Jjjs::every_day_auto_sf_point();
	    /*
	    $model = new Model();
	    //$user_arr = ['13328917666','13599358108','18279498199'];
	    $user_arr = [68=>5000,34=>20000,38=>1000];
	    foreach($user_arr as $key=>$value)
	    {
	        $user_id = $key;
	        $je      = $value;
	        //echo $user_id.' '.$je."<br>";
	        $user_obj = $model->table("user")->fields("id,name")->where("id=$user_id")->find();
	        $user_name = $user_obj['name'];
	        if($key == 68)
	        {
	            $str = $user_name.'账户余额 兑换 消费券';
	        }
	        else
	        {
	            $str = $user_name.'通用积分 兑换 消费券';
	        }
	        
	        Jjjs::xfq_shopping_zs_point($user_id, $je, $str);
	        
	    }
	    */
	    /*
	    for($i=0; $i < $user_arr.length; $i++)
	    {
	        $user_id = intval($user_arr[$i]);
	        //兑换时，赠送给正式会员的
	        self::xfq_shopping_zs_point($user_id, $je, $from_info);
	    }
	    */
	    
	    //Jjjs::sj_and_save_xzyj(3, 516);
	    //Jjjs::exec_all_jj(11, 4, 518);
	    //Jjjs::every_day_auto_sf_point();
	    die;
	    //FileSecache::getInstance();
	    
	    //echo Common::create_number(2);die;
// 	    //改变所有的表为指定的存储引擎
// 	    $model = new Model();
// 	    $list = $model->query("show tables;");
	    
// 	    for($i=0,$c=count($list); $i<$c; $i++)
// 	    {
// 	        $table_name = $list[$i]['Tables_in_chuangyun'];
// 	        $model->query("alter table $table_name engine=innodb;");
// 	    }
	    
	    //Jjjs::every_day_fan();
	    //Jjjs::js_seller_and_user_need_fan_je(489);
		//header('content-type:text/html;charset=utf-8');
		//ZfbWyPay::pay('20164334', 'df', 200.00, 'http://www.baidu.com');
		
		//header('content-type:text/html;charset=utf-8');
		//Common::getSpecByProductId(165);
//		$model =new Model();
//
//        $m = new Model("version");
//
//        $obj=$model->query("select max(version_code) as max_version_code from zyk_version");
//
//        $result = $m->where("version_code=".$obj[0]['max_version_code'])->find();
//
//        $config=Config::getInstance();
//
//		$domain=$config->get("domain");
//        $url=$domain.$result['url'];
//        echo $url;die;
	}
}
?>